from django.http import HttpResponse, JsonResponse
from django.shortcuts import render, redirect

# Create your views here.
from django.urls import reverse
from django.views import View


class testresponse(View):
    def get(self, request):
        res = HttpResponse('123546', status=200)

        return res

    def post(self, request):
        data_dict = {
            "name" : "xiaoming",
            "age" : 20,

        }
        jres = JsonResponse(data_dict)
        return jres


class indexview(View):
    def get(self, request):
        return HttpResponse("这里是主页")


class loginview(View):
    def post(self, request):
        reverse_url = reverse('responseapp:index')
        print(reverse_url)
        return redirect(reverse_url)